<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>瑞州支付</title>
	<link rel="stylesheet"  href="css/jquery.mobile-1.2.0.css" />
	<script src="js/jquery.js"></script>
	<script src="js/jquery.mobile-1.2.0.js"></script>
	<style type="text/css">
		body{font-size:14px;}
		.red{
			color:red;
		}
		.intro{
			color:#999;
		}
	</style>
	<script type="text/javascript">
		var check = false;
		var price = 0;
		var rec_price =0;
		var item_name ="";
		 //接收商品信息
 		$(function(){
 			try{
 				var OrderInfoJsonData = window.JsGameCenter.getOrderInfo();
 			} catch(e) {
 				$("#wrongOrder_popup").popup("open");
 				setTimeout("closePopup('#wrongOrder_popup')",2000);
 				window.JsGameCenter.closeWebView();
 			}
			
 			var orderInfo = eval('('+OrderInfoJsonData+')');

 			$("#MerId").val(orderInfo.MerId);
 			$("#OrderId").val(orderInfo.OrderId);
 			$("#ProdName").val(orderInfo.ProdName);
			$(".product_name").html(orderInfo.ProdName);
 			$("#EncString").val(orderInfo.EncString);
 			$("#NoticeUrl").val(orderInfo.NoticeUrl);
 			$("#AccountNo").val(orderInfo.AccountNo);
			rec_price = orderInfo.Price;
			item_name = orderInfo.ItemName;
			if(rec_price!=-1){
				$("#Price").val(rec_price);
				$("#form").submit();
			}
			if(item_name!=""){
				$("#item_name").show();
				$(".item_name").html(item_name);
			
			}
 		});

		$(function(){
			$('input:radio[name="money"]').click(function(){
				$("#userInputMoney").val("");
				price = $(this).val();
			});
			$("#userInputMoney").focus(function(){
				price = 0;
				$('input:radio[name="money"]:checked').parent().children("label").removeClass("ui-radio-on"); //移除选中
				$('input:radio[name="money"]:checked').parent().children("label").addClass("ui-radio-off"); //添加未选中
				$('input:radio[name="money"]:checked').parent().children("label").children("span").children("span").eq(1).removeClass("ui-icon-radio-on");//移除选中
				$('input:radio[name="money"]:checked').parent().children("label").children("span").children("span").eq(1).addClass("ui-icon-radio-off");//添加未选中
				$("input:radio[name='money']").attr("checked",false);
			});
		
			$("#userInputMoney").blur(function(){
				if($(this).val() != ""){
					price = $(this).val();
				}
			});
					
			$('#form').submit(function(){
				$("#Price").val(price);
				if(price == 0){
					$("#noChoose_popup").popup("open");
					setTimeout("closePopup('#noChoose_popup')",2000);
					return false;
				}
				if($('input:radio[name="money"]').is(":checked") == false){
					if(/\D/.test(price)){
						$("#mustInt_popup").popup("open");
						setTimeout("closePopup('#mustInt_popup')",2000);
						return false;
					}
					if(price < 5){
						$("#wrMoney_popup").popup("open");
						setTimeout("closePopup('#wrMoney_popup')",2000);
						return false;						
					}
				}
				showLoader("正在转入支付宝,请稍后...");
			});
		});
		function closePopup(eleStr){
			$(eleStr).popup("close")
		}
	</script>
	<script type="text/javascript">
		//显示加载器
		function showLoader(str) {
			$.mobile.loading('show', {
				text: str, 			//加载器中显示的文字
				textVisible: true, //是否显示文字
				theme: 'a',         //加载器主题样式a-e
				textonly: false,   //是否只显示文字
				html: ""             //要显示的html内容，如图片等
			});
		}
	</script>
</head>
<body>
<div data-role="page" data-theme="d">
	<div data-role="header" data-theme="b" data-position="fixed">
		<h1>支付宝充值</h1>
	</div>
	<div data-role="content">
		你选择的游戏： <span class="red product_name" ></span> <br />
		<div id="item_name" style="display:none;">道 具 名 称&nbsp;&nbsp;&nbsp;&nbsp;： <span class="red item_name" ></span><br /></div>
		充 值 方 式&nbsp;&nbsp;&nbsp;&nbsp;：<span class="red">支付宝</span>
		
		<br />
		<form id="form" action="http://210.83.86.176/mpay/index.php/pay" method="post" id="form">
		    <fieldset data-role="controlgroup" id="unicomTcd">
					<legend>选择充值金额:</legend>
					<input  type="radio" name="money" value="10" id="c1">
					<label for="c1"  data-theme="c">10元</label>
					<input  type="radio" name="money" value="20" id="c2">
					<label for="c2"  data-theme="c">20元</label>
					<input type="radio" name="money" value="30" id="c3">
					<label for="c3"  data-theme="c">30元</label>
					<input type="radio"  name="money" value="50" id="c4">
					<label for="c4"  data-theme="c">50元</label>
					<input type="radio" name="money" value="100" id="c5">
					<label for="c5"  data-theme="c">100元</label>
					<input type="radio" name="money" value="200" id="c6">
					<label for="c6" data-theme="c">200元</label>
					<input type="radio" name="money" value="300" id="c7">
					<label for="c7" data-theme="c">300元</label>
					<input type="radio"  name="money" value="500" id="c8">
					<label for="c8" data-theme="c">500元</label>
				</fieldset>
		    <br />
		    <label for="userInputMoney"  data-theme="c">您也可以输入充值金额(最低5元):</label>
		    <input type="number"   id="userInputMoney" value="" /><br />
		    
		    <input type="submit" value="立即充值"  id="alipay" data-icon="check" data-theme="b" >
			<input type="hidden" id="MerId"  name="MerId" value="" />
			<input type="hidden" id="OrderId"    name="OrderId" value="" />
			<input type="hidden" id="ProdName"    name="ProdName" value="" />
			<input type="hidden" id="EncString"    name="EncString" value="" />
			<input type="hidden" id="NoticeUrl"    name="NoticeUrl" value="" />
			<input type="hidden" id="PayType"    name="PayType" value="alipay" />
			<input type="hidden" id="AccountNo"    name="AccountNo" value="" />
			<input type="hidden" id="Price"    name="Price" value="" />
	    </form>
		<br />
		<div data-role="popup" id="carddeno_popup" class="ui-content" data-theme="e" style="max-width:350px;">
	          <p>请选择您的充值金额</p>
		</div>
		<div data-role="popup" id="wrongOrder_popup" class="ui-content" data-theme="e" style="max-width:350px;">
	          <p>订单信息获取失败</p>
		</div>
		<div data-role="popup" id="wrMoney_popup" class="ui-content" data-theme="e" style="max-width:350px;">
	          <p>输入的金额不能低于5元</p>
		</div>
		<div data-role="popup" id="noChoose_popup" class="ui-content" data-theme="e" style="max-width:350px;">
	          <p>请选择或者输入充值金额</p>
		</div>
		<div data-role="popup" id="mustInt_popup" class="ui-content" data-theme="e" style="max-width:350px;">
	          <p>输入的充值金额必须是整数</p>
		</div>
		<div id="notice">
			<p class="intro">温馨提示:</p>
			<p class="intro">1.由于网络原因,充值到账可能存在一定延迟,请耐心等待.</p>
			<p class="intro">2.如在支付过程中出现任何问题,请拨打支付宝客服热线:0571-88156688</p>
		</div>
	</div>
</div>

</body>
</html>
